package templates

import (
	"comment/models"
	"github.com/astaxie/beego"
)

func HasPermission(userId int, name string) bool {
	return models.FindPermissionByUserIdAndPermissionName(userId, name)
}

func SerialNumber(index int, count int, pageNo int, pageSize int) int {
	return index + count + pageSize*(pageNo-1)
}

func init() {
	beego.AddFuncMap("haspermission", HasPermission)
	beego.AddFuncMap("serialNumber", SerialNumber)
}
